Added a timestamp to the logging output by trace_io.
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Mon, 24 Oct 2005 13:12:42 +0000 (14:12 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Mon, 24 Oct 2005 13:12:42 +0000 (14:12 +0100)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/xenstore/xenstored_core.c

index f5b1b014e33dd0d3aaea33486fc86779fc489e53..00c64719de01bb0d9002ae79cb61889b71b89530 100644 (file)
@@ -178,12 +178,18 @@ static void trace_io(const struct connection *conn,
 {
        char string[64];
        unsigned int i;
+       time_t now;
+       struct tm *tm;
 
        if (tracefd < 0)
                return;
 
+       now = time(NULL);
+       tm = localtime(&now);
+
        write(tracefd, prefix, strlen(prefix));
-       sprintf(string, " %p ", conn);
+       sprintf(string, " %p %0d:%0d:%0d ", conn, tm->tm_hour, tm->tm_min,
+               tm->tm_sec);
        write(tracefd, string, strlen(string));
        write(tracefd, sockmsg_string(data->hdr.msg.type),
              strlen(sockmsg_string(data->hdr.msg.type)));